import Vue from "vue"
import Vuex from "vuex"
import {ajax} from "@/api"
import  createPersistedstate from "vuex-persistedstate"
Vue.use(Vuex)
// vuex 持久化  

const store = new Vuex.Store({
    plugins:[createPersistedstate()],
    modules:{
      
    },
    state:{
        cartNum:0,
        city:null,   // 城市数据信息 
        cityList:[],  // 城市列表  
        cinemaList:[] , // 当前城市的所有的电影院 
        userInfo:null,
        goodList:[],
        cartList:[]
    },
    actions:{

    },
    mutations:{
      changecartNum(state,payload){
        state.cartNum = payload;
      },
      changeCity(state,payload){
        state.city = payload;
      },
      changeCityList(state,payload){
        state.cityList = payload;
      },
      changeCinemaList(state,payload){
        state.cinemaList = payload;
      },
      changeUserInfo(state,payload){
        state.userInfo = payload 
      },
      changeGoodList(state,payload){
        state.goodList = payload 
      },
      changeCartList(state,payload){
        state.cartList = payload 
      },
    },
    getters:{

    },
})

export default store; 